﻿using System.Configuration;
using Google.Analytics.Model;
using Google.Analytics.RemoteAccess.API;
using NUnit.Framework;

namespace Google.Analytics.RemoteAccessTests
{
    public class RemoteAccessTestsBase
    {
        protected string username;
        protected string password;
        protected string id;

        protected AuthState State { get; private set; }

        [SetUp]
        public void SetUp()
        {
            username = ConfigurationManager.AppSettings["username"];
            password = ConfigurationManager.AppSettings["password"];
            id = ConfigurationManager.AppSettings["id"];

            var api = new AnalyticsAPI(new AuthState(username, password, null));
            State = api.ForceAuthentication();
            Assert.IsNotEmpty(State.QueryAuthenticationToken, "Invalid authentication token");
        }
    }
}
